package com.example.demo.service.impl;


import com.example.demo.entity.Alarmitems;
import com.example.demo.mysqlDao.MysDao;
import com.example.demo.mysqlDao.PersonnelDao;
import com.example.demo.oracleDao.OrcalDao;
import com.example.demo.service.PersonnelService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class PersonnelServiceImpl implements PersonnelService {

    @Resource
    private MysDao mysDao;

    @Resource
    private PersonnelDao personnelDao;

    @Resource
    private OrcalDao orcaldao;


    @Override
    public Map<String, Object> selectTest(Map<String, Object> params) {
        List<Map<String,Object>> resultMap = personnelDao.selectTest(params);
        Map<String, Object> data = new HashMap<>();
        data.put("totalList", resultMap);

        return data;
    }

    @Override
    public Map<String, Object> selectTestOracle(Map<String, Object> params) {
        List<Map<String, Object>> resultMap = orcaldao.selectTestOracle(params);
        Map<String, Object> data = new HashMap<>();
        data.put("totalList", resultMap);

        return data;
    }

    @Override
    public Map<String, Object> selectCron(Map<String, Object> params) {
        Map<String,Object> resultMap = personnelDao.selectCron(params);
        return resultMap;
    }

    @Override
    public int updateCron(Map<String, Object> params) {

        return mysDao.updateCron(params);
    }

    @Override
    public Map<String, Object> Test() {
        Map params = new HashMap();
        params.put("code","2611aa7e-97f9-4f8b-b1ee-388987c36854");
        params.put("sysId","OFF");
        List<Map<String,Object>> resultMysql = personnelDao.selectTest(params);
        List<Alarmitems> resultOracle = orcaldao.selectTestOracle(params);
        Map<String, Object> data = new HashMap<>();
        data.put("mysqlList", resultMysql);
        data.put("OracleList", resultOracle);

        return data;
    }
}
